
 const int AVG_CONST = 5;
 
 long int leftValue[AVG_CONST];
 long int rightValue[AVG_CONST];
 long int leftSum = 0;
 long int rightSum = 0;
 float leftAvg = 0.0;
 float rightAvg = 0.0;

void setup() {
  Serial.begin(9600);
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
}

void loop() {
  leftSum = 0;
  rightSum = 0;
  for(int i = 0; i<AVG_CONST; ++i)
  {
    leftValue[i] = analogRead(A1);
    rightValue[i] = analogRead(A0);
  }
  
  for(int i = 0; i<AVG_CONST; ++i)
  {
    leftSum += leftValue[i];
    rightSum += rightValue[i];
  }
  
  leftAvg = ((float)leftSum) / ((float)AVG_CONST);
  rightAvg = ((float)rightSum) / ((float)AVG_CONST);
//  if(leftValue - rightValue > 0)
//    ++pos;
//  else if(leftValue - rightValue < 0)
//    ++neg;
//  if(Serial.available() > 0)
//  {
//    Serial.read();
//    Serial.print("# of Neg: ");
//    Serial.print(neg);
//    Serial.print("\t\t");
//    Serial.print("# of Pos: ");
//    Serial.println(pos);
//  }
  Serial.print("Left Sensor: ");
  Serial.print(leftAvg);
  Serial.print(" | ");
  Serial.print("Right Sensor: ");
  Serial.print(rightAvg);
  Serial.print(" | ");
  Serial.print("left - right: ");
  Serial.println(leftAvg - rightAvg);
  delay(200);
}
